import request from '@/utils/request'
export function generateConfig() {
  return request({
    method: 'post',
    url: '/deploy/generate_deploy_yaml'
  })
}

export function deployFabric(data) {

  return request({
    method: 'post',
    url: '/deploy/deployFabric',
    data: JSON.stringify(data),
  })
}

export function deployJava() {

  return request({
    method: 'post',
    url: '/deploy/jarBlock',
    headers: {
      'Content-Type': 'application/json'
    },
  })
}

export function getOrgList() {
  return request({
    method: 'post',
    url: '/deploy/OrgListByStatus',
    headers: {
      'Content-Type': 'application/json'
    },
    data: '1'
  })
}

export function getOldOrg(orgName, orgHosts) {
  let data = {
    "name": orgName,
    "hosts": orgHosts
  }
  return request({
    method: 'post',
    url: '/deploy/chooseOldOrg',
    headers: {
      'Content-Type': 'application/json'
    },
    data: JSON.stringify(data),
  })
}

export function getOrgHost(data) {

  return request({
    method: 'post',
    url: '/deploy/chooseOrgHost',
    headers: {
      'Content-Type': 'application/json'
    },
    data: JSON.stringify(data),
  })
}


export function getChannelList() {
  return request({
    method: 'post',
    url: '/deploy/ChaListByStatus',
    headers: {
      'Content-Type': 'application/json'
    },
    data: '1'
  })
}

export function getOldChannel(channelName, channelOrgs) {
  let data = {
    "name": channelName,
    "orgs": channelOrgs
  }
  return request({
    method: 'post',
    url: '/deploy/chooseOldChannel',
    headers: {
      'Content-Type': 'application/json'
    },
    data: JSON.stringify(data),
  })
}
export function getChannelOrg(data) {

  return request({
    method: 'post',
    url: '/deploy/chooseChannelOrg',
    headers: {
      'Content-Type': 'application/json'
    },
    data: JSON.stringify(data),
  })
}


export function generateExtendConfig() {
  return request({
    method: 'post',
    url: '/deploy/generate_extend_yaml'
  })
}

export function checkOrgNext() {
  return request({
    method: 'post',
    url: '/deploy/checkOrgNext'
  })
}

export function checkChannelNext() {
  return request({
    method: 'post',
    url: '/deploy/checkChannelNext'
  })
}
